package cn.jetpiece.cloud.system.dp.api.biz;

import cn.jetpiece.cloud.model.page.PageResult;
import cn.jetpiece.cloud.model.response.Result;
import cn.jetpiece.cloud.resource.annotation.annotation.ApiResource;
import cn.jetpiece.cloud.resource.annotation.annotation.ScanResource;
import cn.jetpiece.cloud.system.dp.api.biz.model.params.OpenApiParam;
import cn.jetpiece.cloud.system.dp.api.biz.model.params.ProjectAddParam;
import cn.jetpiece.cloud.system.dp.api.biz.model.result.DpTApiResult;
import cn.jetpiece.cloud.system.dp.api.biz.model.result.DpTProjectResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.validation.Valid;
import java.util.Map;

/**
 * dp_t_api
 *
 * @author jetpiece
 * @since 2023-05-15
 */
@Api(tags="dp_open_api")
@ApiResource(name="dp_open_api")
public interface DpTOpenApi {

    String AUTH_API = "/datapipeline/api/auth";

    String OMS_API = "/datapipeline/oms/project";

    String APISET_API = "/datapipeline/openApi/power/queryAuthSynchApiSet";

    String PROJECTSET_API = "/datapipeline/openApi/power/queryAuthProjectSet";

    /**
     * 认证获取
     *
     * @param param 新增参数
     * @return 返回结果
     */
    @ApiOperation(value = "认证获取")
    @ScanResource(name = "认证获取", path = AUTH_API, method = RequestMethod.POST)
    Result<Map<String, Object>> auth(@RequestBody @Valid OpenApiParam param);

    /**
     * api授权列表
     *
     * @return 返回结果
     */
    @ApiOperation(value = "api授权列表")
    @ScanResource(name = "api授权列表", path = APISET_API, method = RequestMethod.POST)
    Result<PageResult<DpTApiResult>> queryAuthSynchApiSet();

    /**
     * 项目授权列表
     *
     * @return 返回结果
     */
    @ApiOperation(value = "项目授权列表")
    @ScanResource(name = "项目授权列表", path = PROJECTSET_API, method = RequestMethod.POST)
    Result<PageResult<DpTProjectResult>> queryAuthProjectSet();


    /**
     * oms项目同步
     *
     * @param param 新增参数
     * @return 返回结果
     */
    @ApiOperation(value = "oms项目同步")
    @ScanResource(name = "oms项目同步", path = OMS_API, method = RequestMethod.POST)
    Result<String> syncOmsProject(@RequestBody @Valid ProjectAddParam param);
}
